# eric7.MicroPython.Devices.CircuitPythonUpdater.CircupFunctions

Module implementing variants of some 'circup' functions suitable for 'eric-ide' integration.

### Global Attributes

None

### Classes

None

### Functions

ensure_latest_bundle | Function to ensure that there's a copy of the latest library bundle available so circup can check the metadata contained therein.
find_modules | Function to extract metadata from the connected device and available bundles and returns this as a list of Module instances representing the modules on the device.
get_circuitpython_version | Function to return the version number of CircuitPython running on the board connected via ``device_path``, along with the board ID.
install_module | Function to find a connected device and install a given module name.
patch_circup | Function to patch 'circup' to use our functions adapted to the use within the eric-ide.

## ensure_latest_bundle

ensure_latest_bundle(bundle)

Function to ensure that there's a copy of the latest library bundle available so circup can check the metadata contained therein.

bundle (circup.Bundle)
  reference to the target Bundle object.

Up

## find_modules

find_modules(device_path, bundles_list)

Function to extract metadata from the connected device and available bundles and returns this as a list of Module instances representing the modules on the device.

device_path (str or circup.DiskBackend)
  path to the connected board or a disk backend object
bundles_list (list of circup.Bundle)
  list of supported bundles

Return:
  list of Module instances describing the current state of the modules on the connected device

Return Type:
  list of circup.module.Module

Up

## get_circuitpython_version

get_circuitpython_version(device_path)

Function to return the version number of CircuitPython running on the board connected via ``device_path``, along with the board ID.

This is obtained from the 'boot_out.txt' file on the device, whose first line will start with something like this:

Adafruit CircuitPython 4.1.0 on 2019-08-02;

While the second line is:

Board ID:raspberry_pi_pico

device_path (str)
  path to the connected board.

Return:
  tuple with the version string for CircuitPython and the board ID string

Return Type:
  tuple of (str, str)

Up

## install_module

install_module(device_path, device_modules, name, py, mod_names)

Function to find a connected device and install a given module name.

Installation is done if it is available in the current module bundle and is not already installed on the device.

device_path (str)
  path to the connected board
device_modules (list of dict)
  list of module metadata from the device
name (str)
  name of the module to be installed
py (bool)
  flag indicating if the module should be installed from source or from a pre-compiled module
mod_names (dict)
  dictionary containing metadata from modules that can be generated with circup.get_bundle_versions()

Return:
  flag indicating success

Return Type:
  bool

Up

## patch_circup

patch_circup()

Function to patch 'circup' to use our functions adapted to the use within the eric-ide.

Up